<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>


<table border="0" style="width:100%;height: 100%;font-family: Arial,sans-serif; font-weight: bold; font-size: 13px; z-index: 20; border-bottom: 1px solid black" >
    <tr>
        <td style="width: 20%;text-align: left" >
            Filtros:
        </td>
        <td style="text-align: center; min-width: 135px">
            <select id="cbo_capas" class="select_capa" onchange="cambio_capa(this, '${param.id_frawor}')" ${geoconten.modoEdicion?'disabled':''} >
                <c:forEach var="f" items="${escenario.l_filtros_disponibles}">
                    <option value="${f.nu_geocap}" ${(f.nu_geocap == escenario.filtro_selec.nu_geocap)?'selected':''}>${f.no_geocap}</option>
                </c:forEach>
            </select>
        </td>
        <td style="text-align: center">
            <div class="btn_sort" onclick="ordenarAgrupamientos('${param.id_frawor}', 'cantidad')">
                <img src="../img/gps/sort_number_${escenario.ti_sortca}.png" >
            </div>
        </td>
        <td style="text-align: center">
            <div class="btn_sort" onclick="ordenarAgrupamientos('${param.id_frawor}', 'nombre')">
                <img src="../img/gps/sort_name_${escenario.ti_sortno}.png" >
            </div>
        </td>
    </tr>
    <tr>
        <td colspan="4" >
            <div class="dv_agrupamientos">
                <table id="tb_agrupamientos" cellpadding="1" cellspacing="0">
                    <c:forEach var="a" items="${escenario.filtro_selec.l_agrupa}">
                        <c:if test="${geoconten.ocultarVacios == false}">
                            <tr ${(a.il_select)?'style="color:black"':''}>
                                <td>${a.no_agrupa}</td>
                                <td>${fn:length(a.l_config)}</td>
                                <td style="min-width: 30px" >
                                    <a class="eye" id="${(a.il_select)?'1':'0'}" ti_puncol="${a.ti_puncol}" nu_geocapval="${a.nu_geocapval}" onclick="cambio_puntos('click', '${param.id_frawor}', '${a.ti_puncol}', '${a.nu_geocapval}', this, true, ${geoconten.modoEdicion})" ondblclick="cambio_puntos('dbclick', '${param.id_frawor}', '${a.ti_puncol}', '${a.nu_geocapval}', this, true, ${geoconten.modoEdicion})">
                                        <img src="${pageContext.request.contextPath}/img/gps/eye_${(a.il_select)?'open':'cancel'}.png" height="14px"> 
                                    </a>
                                </td>
                                <td><div style="width: 10px; height: 10px; background-color: ${a.ti_puncol}; display: inline-block"></div></td>
                            </tr>
                        </c:if>
                        <c:if test="${geoconten.ocultarVacios == true && fn:length(a.l_config)>0}">
                            <tr ${(a.il_select)?'style="color:black"':''}>
                                <td>${a.no_agrupa}</td>
                                <td>${fn:length(a.l_config)}</td>
                                <td style="min-width: 30px" >
                                    <a class="eye" id="${(a.il_select)?'1':'0'}" ti_puncol="${a.ti_puncol}" nu_geocapval="${a.nu_geocapval}" onclick="cambio_puntos('click', '${param.id_frawor}', '${a.ti_puncol}', '${a.nu_geocapval}', this, true, ${geoconten.modoEdicion})" ondblclick="cambio_puntos('dbclick', '${param.id_frawor}', '${a.ti_puncol}', '${a.nu_geocapval}', this, true, ${geoconten.modoEdicion})">
                                        <img src="${pageContext.request.contextPath}/img/gps/eye_${(a.il_select)?'open':'cancel'}.png" height="14px"> 
                                    </a>
                                </td>
                                <td><div style="width: 10px; height: 10px; background-color: ${a.ti_puncol}; display: inline-block"></div></td>
                            </tr>
                        </c:if>
                    </c:forEach>
                </table>
            </div>
        </td> 
        <td></td>
    </tr>
    <c:if test="${geoconten.modoEdicion}">
        <tr>
            <td colspan="4">
                <div onclick="terminar_edicion('${param.id_frawor}')" class="filter">
                    <img src="${pageContext.request.contextPath}/img/gps/check.png" align="top">
                    Hecho
                </div>
            </td>
        </tr>
    </c:if>
    <c:if test="${!geoconten.modoEdicion}">
        <c:if test="${fn:length(escenario.l_filtros_disponibles)>1 && geoconten.portafolio == null}">
            <tr>
                <td colspan="4">
                    <div onclick="filtrar_agrupamientos('${param.id_frawor}')" class="filter">
                        <img src="${pageContext.request.contextPath}/img/gps/filter1.png" align="top">
                        Filtrar
                    </div>
                </td>
            </tr>
            
        </c:if>
        <%--c:if test="${geoconten.portafolio != null}">
            <tr>
                <td colspan="4">
                    <div onclick="grabar('${param.id_frawor}')" class="filter">
                        <img src="${pageContext.request.contextPath}/img/gps/grabar.png" align="top">
                        Grabar
                    </div>
                </td>
            </tr>
        </c:if--%>
        <tr>
            <td colspan="4">
                <div onclick="${(geoconten.portafolio==null)?'crear_portafolio(\''.concat(param.id_frawor).concat('\')'):'eliminar_portafolio(\''.concat(param.id_frawor).concat('\')')}" class="filter">
                    <img src="${pageContext.request.contextPath}/img/gps/portafolio.png" align="top">
                    ${(geoconten.portafolio==null)?'Portafolio':'Cerrar portafolio'}
                </div>
            </td>
        </tr>
        <c:if test="${geoconten.portafolio == null}">
            <tr>
                <td colspan="4">
                    <div onclick="seleccionar_puntos('${param.id_frawor}')" class="filter">
                        <img src="${pageContext.request.contextPath}/img/gps/seleccion.png" align="top">
                        Seleccionar puntos
                    </div>
                </td>
            </tr>
        </c:if>
    </c:if>
</table>